<html>
<head><meta charset="utf-8"><title>cg_clif rustc bootstrap crash · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/cg_clif.20rustc.20bootstrap.20crash.html">cg_clif rustc bootstrap crash</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="194721462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/cg_clif%20rustc%20bootstrap%20crash/near/194721462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/cg_clif.20rustc.20bootstrap.20crash.html#194721462">(Apr 20 2020 at 19:26)</a>:</h4>
<p>I got rustc bootstrapping using cg_clif. Unfortunately the rustc built using cg_clif crashes when you try to use it. So far I have been able to pin point that <code>make_input</code> returns an <code>io::Error</code>. When trying to <code>.to_string()</code> it it turns out that the <code>io::Error</code> has an invalid discriminant.</p>
<p><strong>How do I continue debugging from this point on?</strong> I normally just removed code piece by piece and added printf for values I suspected to be corrupted. However for rustc this is not feasible, as the recompilation takes way too long.</p>
<p>Rust fork: <a href="https://github.com/bjorn3/rust/commit/e5c309197bf97c12c5d0782b9300417a52c80f66" title="https://github.com/bjorn3/rust/commit/e5c309197bf97c12c5d0782b9300417a52c80f66">https://github.com/bjorn3/rust/commit/e5c309197bf97c12c5d0782b9300417a52c80f66</a> (branch cg_clif_subtree)<br>
cg_clif commit: <a href="https://github.com/bjorn3/rustc_codegen_cranelift/commit/f7eb36070c602f0dccca26ccec83f1c003cb27dd" title="https://github.com/bjorn3/rustc_codegen_cranelift/commit/f7eb36070c602f0dccca26ccec83f1c003cb27dd">https://github.com/bjorn3/rustc_codegen_cranelift/commit/f7eb36070c602f0dccca26ccec83f1c003cb27dd</a> (branch wip_proc_macro_fixes, clone it to <code>src/rustc_codegen_cranelift</code> in the rust source repo)<br>
Cranelift commit: <a href="https://github.com/bjorn3/wasmtime/commit/2d60da466dc375b0cb08ad62e49879927f176619" title="https://github.com/bjorn3/wasmtime/commit/2d60da466dc375b0cb08ad62e49879927f176619">https://github.com/bjorn3/wasmtime/commit/2d60da466dc375b0cb08ad62e49879927f176619</a> (pr <a href="https://github.com/bytecodealliance/wasmtime/issues/1559" title="https://github.com/bytecodealliance/wasmtime/issues/1559">bytecodealliance/wasmtime#1559</a>, clone it to the parent dir of the rust repo, or edit Cargo.toml of the rust repo to point to it in the patch section)</p>
<p>config.toml:</p>
<div class="codehilite"><pre><span></span><span class="k">[rust]</span>
<span class="n">codegen-backends</span> <span class="o">=</span> <span class="k">[&quot;cranelift&quot;]</span>
<span class="n">deny-warnings</span> <span class="o">=</span> <span class="kc">false</span>
</pre></div>



<a name="194723696"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/cg_clif%20rustc%20bootstrap%20crash/near/194723696" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/cg_clif.20rustc.20bootstrap.20crash.html#194723696">(Apr 20 2020 at 19:47)</a>:</h4>
<p>^ any suggestions?</p>



<a name="195380024"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/cg_clif%20rustc%20bootstrap%20crash/near/195380024" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/cg_clif.20rustc.20bootstrap.20crash.html#195380024">(Apr 27 2020 at 07:15)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> you can try to use <code>rr</code> to find the code that last wrote the memory address containing the bad discriminant</p>



<a name="195388507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/cg_clif%20rustc%20bootstrap%20crash/near/195388507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/cg_clif.20rustc.20bootstrap.20crash.html#195388507">(Apr 27 2020 at 08:48)</a>:</h4>
<p>Good idea!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>